<html>
<head><meta charset="utf-8"><title>getting started · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html">getting started</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216300349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216300349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216300349">(Nov 11 2020 at 02:10)</a>:</h4>
<p>Hi there! What is a good way to get started with working on MIR optimizations? I looked through the issues tagged with <code>A-mir-opt</code> and there are no E-easy issues, and only one E-mentor issue, which is in fact assigned to <span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span>. I have a basic understanding of data-flow analysis and I've worked on other parts of rustc.</p>



<a name="216321012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216321012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216321012">(Nov 11 2020 at 09:05)</a>:</h4>
<p>We have reached a sort of equilibrium right now where any fancy optimizations require major implementation work and already have someone focussing on it. If you are also interested in just cleaning up our existing optimizations, here's one issue that may require dataflow in order to make correct: <a href="https://github.com/rust-lang/rust/issues/78368">https://github.com/rust-lang/rust/issues/78368</a></p>



<a name="216322704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216322704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216322704">(Nov 11 2020 at 09:23)</a>:</h4>
<p>oh... apologies, I just realized while going through my notifications that this issue is in fact addressed in a just newly opened PR: <a href="https://github.com/rust-lang/rust/pull/78928">https://github.com/rust-lang/rust/pull/78928</a></p>



<a name="216402893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216402893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216402893">(Nov 11 2020 at 21:49)</a>:</h4>
<p>Any other recommendations then?</p>



<a name="216412190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216412190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216412190">(Nov 11 2020 at 23:55)</a>:</h4>
<p>What's the state of whether MIR needs to be type-correct after optimizations these days?</p>
<p>I was pondering whether we could strip away all <code>repr(transparent)</code> types as a MIR optimization, or even just <code>ManuallyDrop</code> (which is already a lang item) -- I have a few experiments where the extra copy from an argument into a <code>ManuallyDrop</code> meant that it added a bunch of stack usage for the copy that shouldn't be needed.</p>



<a name="216439020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216439020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216439020">(Nov 12 2020 at 08:24)</a>:</h4>
<p>Right now MIR assignments need to have the same type (modulo some special cases) on the LHS and RHS</p>



<a name="216439046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216439046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216439046">(Nov 12 2020 at 08:24)</a>:</h4>
<p>but this is not something built in stone, in fact it has been discussed every now and then whether we should lift this restriction</p>



<a name="216439070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216439070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216439070">(Nov 12 2020 at 08:24)</a>:</h4>
<p>I think if you do an MCP with that motivation it would go through</p>



<a name="216459861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216459861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216459861">(Nov 12 2020 at 12:15)</a>:</h4>
<p>do you have thoughts on more exploratory work maybe, whether it'd be about looking for optimizations, IRs, or validating our existing optimizations ? (a fun note is that sometimes all those can be done by a single thing, for example equality saturation -- which eternaleye and eddy liked a lot IIRC -- and is also fun because there's work done in rust for e-graphs in the <a href="https://github.com/egraphs-good/egg">egg crate</a>)</p>



<a name="216499963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216499963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Simon Vandel Sillesen <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216499963">(Nov 12 2020 at 17:24)</a>:</h4>
<p><span class="user-mention" data-user-id="307537">@Camelid</span> <br>
I just created <a href="https://github.com/rust-lang/rust/issues/78994">https://github.com/rust-lang/rust/issues/78994</a> which perhaps could be of interest to you? I would probably have expected the SimplifyLocals pass to eliminate <code>_2</code>.</p>



<a name="216534530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/getting%20started/near/216534530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/getting.20started.html#216534530">(Nov 12 2020 at 21:53)</a>:</h4>
<p>I'll take a look, thanks :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>